package com.example.user2.dao;

import com.example.user2.entity.User;
import org.apache.ibatis.annotations.*;

@Mapper
public interface UserDao {
    @Results(id = "userMap",value = {
            @Result(property = "username",column = "username"),
            @Result(property = "password",column = "password")
    })
    @Select("select * from user1 where username = #{username} and password = #{password}")
    User getUserByName(@Param("username")String username,@Param("password")String password);


    @Select("select count(1) from user1 where username = #{username}")
    int findUserByName(User user);

    @Insert("insert into user1(username,password) values (#{username},#{password})")
    int creatUser(User user);

}